package edu.sctu.practice.class02.shuqiqi.text19;

/**
 * Created by admin on 2015/11/2.
 */

/**
 * 矩形
 */
public class Rectangular extends Graph1 {
    int lenght = 6;
    double wide = 2.5;

    public Rectangular(String color) {
        super(color);
        System.out.println("矩形");
        System.out.println("颜色：" + color + "\n长：" + lenght + "\n宽：" + wide);

    }

    public double getArea() {
        double area = lenght * wide;
        System.out.println("面积为：" + area);
        return area;
    }

    public double getPerimeter() {
        double perimeter = 2 * (lenght * wide);
        System.out.println("周长为：" + perimeter);

        return perimeter;
    }

    public String toString() {
        return "" + wide + "\n" + lenght;
    }
}
